package com.esyoga.yoyoga.service.impl;

import com.esyoga.yoyoga.mapper.TTrainerMapper;
import com.esyoga.yoyoga.pojo.TTrainer;
import com.esyoga.yoyoga.pojo.TTrainerExample;
import com.esyoga.yoyoga.service.CoachDataService;
import lombok.Data;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Data
@Service
public class CoachDataServiceImpl implements CoachDataService {

    @Resource
    TTrainerMapper tTrainerMapper;


    //展示个人信息
    @Override
    public List<TTrainer> showData(Integer tId) {
        TTrainerExample example = new TTrainerExample();
        TTrainerExample.Criteria criteria = example.createCriteria();
        criteria.andTIdEqualTo(tId);
        return tTrainerMapper.selectByExample(example);
    }

    //修改个人资料
    @Override
    public int updateData(Integer tId, TTrainer tTrainer) {
        tTrainer.settId(tId);
        TTrainerExample example = new TTrainerExample();
        TTrainerExample.Criteria criteria = example.createCriteria();
        criteria.andTIdEqualTo(tId);
        return tTrainerMapper.updateByPrimaryKeySelective(tTrainer);
    }

}
